import { createRouter, createWebHistory } from 'vue-router'
import {routes as ToolsRoutes} from './tools.ts'
import {routes as JsThinsRoutes} from './js-things.ts'
const Home = () => import('@/views/index/home.vue')
const pdfGenerator = () => import('@/views/pdf/pdf-generator.vue')
const DefaultIndex = () => import('@/views/index/default-index.vue')
const htmlThings = () => import('@/views/html-things/html-things.vue')
const svgToCanvas = () => import('@/views/canvas/svg-to-canvas.vue')
const canvas = () => import('@/views/canvas/index.vue')
const tools = () => import('@/views/tools/index.vue')
const JsThings = () => import('@/views/js-things/index.vue')

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'home',
      component: Home,
      children: [
        {
          path: '',
          name: 'default-index',
          component: DefaultIndex,
        },
        {
          path: 'pdf-generator',
          name: 'pdf-generator',
          component: pdfGenerator,
        },
        {
          path: 'html-things',
          name: 'html-things',
          component: htmlThings,
        },
        {
          path: 'canvas',
          name: 'canvas-index',
          component: canvas,
          children: [
            {
              path: 'draw-svg',
              name: 'canvas/draw-svg',
              component: svgToCanvas,
            },
          ],
        },
        {
          path: 'tools',
          component: tools,
          name: 'tools-index',
          children: ToolsRoutes
        },
        {
          path: 'js',
          component: JsThings,
          name: 'js-things',
          children: JsThinsRoutes
        }
      ],
    },
  ],
})

export default router
